package com.journey.org.ui.knowledge

import android.os.Bundle
import com.journey.org.entity.PlayAndroidBannerEntity
import com.journey.org.ui.web.WebActivity
import com.mvvmhabit.org.base.ItemViewModel
import com.mvvmhabit.org.binding.command.BindingAction
import com.mvvmhabit.org.binding.command.BindingCommand
import com.mvvmhabit.org.binding.command.BindingConsumer

/**
 * @Date: 2020/11/17 14:18
 * @Author:小妖
 * @Description: 知识 - banner - item
 */
class KnowLedgeBannerItemViewModel(vm: KnowLedgeViewModel, val entity: PlayAndroidBannerEntity) :
    ItemViewModel<KnowLedgeViewModel>(vm) {

    val onClickBannerItemCommand =
        BindingCommand<Any>(object : BindingAction {
            override fun call() {
                val bundle = Bundle()
                bundle.putString("loadUrl", entity.url)
                bundle.putString("title", entity.title)
                vm.startActivity(WebActivity::class.java, bundle)
            }
        })

}